﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DX_Recognize.UI
{
    public partial class DXComboBox : ComboBox
    {
        public DXComboBox()
        {
            InitializeComponent();
        }

        public DXComboBox(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        //鼠标滚轮事件
        protected override void WndProc(ref Message m)
        {
            const int WM_MOUSEWHEEL = 0x020A;
            if (m.Msg == WM_MOUSEWHEEL)
            {
                base.WndProc(ref m);
                int delta = (int)m.WParam >> 16;
                if (delta > 0)
                {
                    if (SelectedIndex > 0)
                        SelectedIndex--;
                }
                else
                {
                    if (SelectedIndex < Items.Count - 1)
                        SelectedIndex++;
                }
                return;
            }
            base.WndProc(ref m);
        }

    }
}
